package com.ygo.feihua.fragment;

import android.os.*;
import android.support.v4.app.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import android.content.*;
import java.util.*;
import com.cc.chioceFileListView.*;
import com.bumptech.glide.*;
import com.yuyh.library.imgsel.*;
import com.yuyh.library.imgsel.ui.*;
import com.ygo.feihua.R;
import com.ygo.feihua.*;

public class FragmentZsTubiao extends Fragment
{
	ImageView fz_tubiao;
	Gongju gj;
	private ZhutiShangchuan zs;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
	{
		View v=inflater.inflate(R.layout.fragment_zs_tubiao,null);
		
		fz_tubiao=(ImageView) v.findViewById(R.id.fz_tubiao);
		gj=Gongju.getdx(getActivity());
		
		
		fz_tubiao.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View p1)
				{
					
					
					ISNav.getInstance().toListActivity(getActivity(), Gongju.getPicConfig(1), 233);
					
					// TODO: Implement this method
				}
			});
		
		 zs=(ZhutiShangchuan) getActivity();
		 
		 
		Button zs_next=zs.sc_sc;
		zs_next.setText("下一步");
		zs_next.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View p1)
				{

					if(zs.path_tubiao==null){
						gj.show("请选择主题图标");
					}else{
					zs.fragmentManager.beginTransaction().replace(R.id.sc_frage, new FragmentZsYulantu()).commit();

					}
					// TODO: Implement this method
				}
			});
		
		// TODO: Implement this method
		return v;
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data)
	{
		// TODO: Implement this method
		super.onActivityResult(requestCode, resultCode, data);

		if (resultCode == getActivity().RESULT_OK && requestCode == 233) {
			if (data != null) {
				ArrayList<String> photos = data.getStringArrayListExtra(ISListActivity.INTENT_RESULT);
				zs.path_tubiao=photos.get(0);
				//fz_tubiao.setImageBitmap(BitmapOptimization.getBitmap(photos.get(0), fz_tubiao.getWidth()));
				Glide.with(getActivity()).load(zs.path_tubiao).into(fz_tubiao);
				}
				}
				
	}
}
